#ifndef ICONDELEGATE_H
#define ICONDELEGATE_H

#include <QItemDelegate>
#include <QPainter>
#include <QStyleOptionViewItem>
#include <QImage>

class IconDelegate : public QItemDelegate
{
    Q_OBJECT
public:
    explicit IconDelegate(QObject *parent = 0):QItemDelegate(parent){};
    void paint( QPainter* painter, const QStyleOptionViewItem& option, const QModelIndex& index ) const
    {
        QString filename;
        if (index.data().toInt() == 5) filename = ":/icons/L.jpg";
        else if(index.data().toInt() == 1) filename = ":/icons/H.jpg";
        else filename = ":/icons/M.jpg";
        QImage image(filename);
        painter->drawImage(option.rect,image);
    }
signals:
    
public slots:
    
};

#endif // ICONDELEGATE_H
